<!DOCTYPE html>
<html class="x-admin-sm">
{include file='public/header'}

<body>
    <div class="x-body">
        <form class="layui-form" lay-filter="formAjax">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>投手名称
                </label>
                <div class="layui-input-block">
                    <input type="text" name="name" id="name" placeholder="投手名称" required="required" lay-verify="required" autocomplete="off" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>密码
                </label>
                <div class="layui-input-block">
                    <input type="password" name="password" id="password" placeholder="密码" required="required" lay-verify="required" autocomplete="off" class="layui-input" value="">
                </div>
            </div>
            <div class="layui-form-item" style="display: flex;">
                <label class="layui-form-label">
                    <span class="x-red">*</span>公众号
                </label>
                <div id="officialAccount" style="width:100%;flex:1"></div>
            </div>
            

            <input type="hidden" name="id" id="id" value="" />
            <button id="submitData" class="layui-btn" lay-submit lay-filter="submitData" style="display: none;" />
        </form>
    </div>
    <script>
        let params = {
            addUrl: '/cps/pitcher/add',
            editUrl: '/cps/pitcher/edit',
            detailUrl: '/cps/pitcher/detail',
        }
        form_ajax(params)
        let id = GetQueryString('id')
        let selectParams = {
            url: '/cps/officialAccount/select',
            selected: [],
            max: 999,
            tips: '选择公众号',
            name: 'official_account_id',
            field_id: 'id',
            field_Name: 'name',
            elem: '#officialAccount'
        }


        if (id) {
            Ajax(params.detailUrl, { id }).then(result => {
                selectParams.selected = result.data.official_account_id
                selectM(selectParams)
               
            });
        } else {
            selectM(selectParams)
        }


       
    </script>
</body>

</html>